package com.beyondsoft.sabg.edu.model.vo.core;

import com.fasterxml.jackson.annotation.JsonIgnore;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author Mo cr
 * @Date 2023/8/7
 */
public class SimpleResponseVO {
    /**
     * Indicates whether the API invocation is successful
     */
    boolean success;

    //The returned message from server
    String message;

    Map<String, String> messages = new HashMap<String, String>();

    //Returned object
    Object data;

    public Map<String, String> getMessages() {
        return messages;
    }

    public void setMessages(Map<String, String> messages) {
        this.messages = messages;
    }

    public SimpleResponseVO withMessages(Map<String, String> messages) {
        this.messages = messages;
        return this;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        if (message == null) {
            message = "";
        }
        this.message = message;
    }

    public SimpleResponseVO withMessage(String message) {
        if (message == null) {
            message = "";
        }
        this.message = message;
        return this;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {

        this.data = data;
    }

    public SimpleResponseVO withData(Object result) {
        this.setData((result));
        return this;
    }

    public SimpleResponseVO withPropertyMessage(String messageKey, String messageValue) {
        messages.put(messageKey, messageValue);
        return this;
    }
}
